package com.wq.myspring.eventmode;

/**
 * @PackageName: com.wq.myspring.eventmode
 * @ClassName Mytest
 * @Description: TODO
 * @Author Wenqiang
 * @Date 2021/07/18 0:40
 * @Version V1.0
 */
public class Mytest {

	public static void main(String[] args) {

		/*//定义事件
		Event event = new Event();
		event.setType("simpleEvent");

		//创建事件源头
		EventSource eventSource = new EventSource();
		//注册监听器
		eventSource.register(new SimpleEventListener());
		eventSource.register(new ComplexEventListener());
		//发布事件
		eventSource.publishEvent(event);*/

		//修改成观察者模式后

		//定义事件
		Event event = new Event();
		event.setType("simpleEvent");

		//创建事件源头
		EventSource eventSource = new EventSource();
		//注册监听器
		SimpleEventListener simpleEventListener = new SimpleEventListener(eventSource);
		ComplexEventListener complexEventListener = new ComplexEventListener(eventSource);

		//发布事件
		eventSource.publishEvent(event);

	}

}
